package com.study.wait;

/**
 * @author HBZ
 * @description
 * @date 2021/5/12 15:40
 */
public class Producer extends Thread {
    //每次生产的数量
    private int num;

    //所属的仓库
    public AbstractStorage storage;

    public Producer(AbstractStorage storage) {
        this.storage = storage;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public void run() {
        produce(num);
    }

    // 调用仓库Storage的生产函数
    public void produce(int num) {
        storage.produce(num);
    }
}
